<template>
  <div id="app">
    <router-view />
  </div>
</template>

<script>
export default {
  name: 'App',
  // 应用级错误捕获
  errorCaptured(err, vm, info) {
    console.error('App level error captured:', err, info)
    
    // 显示友好的错误提示
    this.$message({
      message: '页面加载出错，请刷新重试',
      type: 'error',
      duration: 5000,
      showClose: true
    })
    
    // 返回 false 阻止错误继续传播
    return false
  },
  mounted() {
    console.log('应用已启动，错误处理已激活')
  }
}
</script>

<style>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif;
}

#app {
  height: 100%;
  position: relative;
}

/* 确保即使出错也不显示崩溃页面 */
#app::before {
  content: '';
  display: none;
}
</style>
